=======================================================================================
FORMULAS DATA FILE
=======================================================================================


=======================================================================================
*BEGIN*
=======================================================================================

Name                := Formula Low Level Cost
Formula             := iif([%Base_Cost%] = 0, 0.00001, iif([%Level%] = 1, 5, [%Level%]) ^ sqrt([%Base_Cost%]) * 100)

Name                := Formula Medium Level Cost
Formula             := iif([%Base_Cost%] = 0, 0.00001, iif([%Level%] = 1, 5, [%Level%]) ^ sqrt([%Base_Cost%] + 1) * 100)

Name                := Formula High Level Cost
Formula             := iif([%Base_Cost%] = 0, 0.00001, iif([%Level%] = 1, 5, [%Level%]) ^ sqrt([%Base_Cost%] + 2) * 100)

Name                := Formula Planet Gravity
Formula             := ([%PlanetSize%]) * ([%PlanetSize%]) / 10 * random(0.8, 1.25)

Name                := Formula Planet Gas Gravity
Formula             := ([%PlanetSize%]) * ([%PlanetSize%]) / 2.5 * random(0.8, 1.25)

Name                := Formula Planet Temperature
Formula             := MAX(-240, 100 - ([%HexDistanceToCenter%] * [%HexDistanceToCenter%] * 3) + Random(-50, 25)) + (([%NumberOfStars%] - 1) * 50)

// Terr planets actually use generic Planet Temperature formula, due to SE5 oddities.
Name                := Formula Planet Terr Temperature
Formula             := MAX(-240, 100 - ([%HexDistanceToCenter%] * [%HexDistanceToCenter%] * 3) + Random(-50, 25)) + (([%NumberOfStars%] - 1) * 50)

Name                := Formula Planet Ven Temperature
Formula             := MAX(-240, 360 - ([%HexDistanceToCenter%] * [%HexDistanceToCenter%] * 3) + Random(-50, 25)) + (([%NumberOfStars%] - 1) * 50)

Name                := Formula Planet Moon Temperature
Formula             := MAX(-240, 80 - ([%HexDistanceToCenter%] * [%HexDistanceToCenter%] * 3) + Random(-50, 25)) + (([%NumberOfStars%] - 1) * 50)

Name                := Formula Planet Ice Temperature
Formula             := MAX(-240, 20 - ([%HexDistanceToCenter%] * [%HexDistanceToCenter%] * 3) + Random(-50, 25)) + (([%NumberOfStars%] - 1) * 20)

Name                := Formula Planet Gas Temperature
Formula             := MAX(-240, 40 - ([%HexDistanceToCenter%] * [%HexDistanceToCenter%] * 3) + Random(-50, 25)) + (([%NumberOfStars%] - 1) * 25)

Name                := Formula Planet Radiation
Formula             := Random(0, 200) + (([%NumberOfStars%] - 1) * Random(25, 75) * 2)

Name                := Formula Planet None Radiation
Formula             := Random(0, 200) + (([%NumberOfStars%] - 1) * Random(25, 75) * 5)

Name                := Formula Planet Radiation
Formula             := Random(0, 300) + IIF([%PlanetAtmosphereName%] = "None", Random(0, 200), 0) + (([%NumberOfStars%] - 1) * Random(50, 100))

Name                := Crew Required 5 Or Less
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 0) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 5)

Name                := Crew Required 6 To 10
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 5) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 10)

Name                := Crew Required 11 To 15
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 10) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 15)

Name                := Crew Required 16 To 20
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 15) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 20)

Name                := Crew Required 21 To 25
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 20) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 25)

Name                := Crew Required 26 To 50
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 25) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 50)

Name                := Crew Required 51 To 75
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 50) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 75)

Name                := Crew Required 76 To 100
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 75) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 100)

Name                := Crew Required 101 To 200
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 100) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 200)

Name                := Crew Required 201 To 300
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 200) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 300)

Name                := Crew Required 301 To 400
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 300) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 400)

Name                := Crew Required 401 To 800
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 400) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 800)

Name                := Crew Required 801 To 1200
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 800) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 1200)

Name                := Crew Required 1201 To 1600
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 1200) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 1600)

Name                := Crew Required 1601 To 2000
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 1600) or (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) > 2000)

Name                := Crew Required 2001 Or More
Formula             := (iif(Get_Design_Specific_Component_Count("Gunboat Computer Core") > 0, 0, iif(Get_Design_Specific_Component_Count("Automated Bridge") > 0, (Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1) * 2) / 2, Get_Design_Ability_Total("AI Tag 01", 1) - Get_Design_Ability_Total("Crew Quarters", 1))) <= 2000)

=======================================================================================
*END*
=======================================================================================
